#ifndef  __CMSG_HPP__
#define  __CMSG_HPP__
#include <memory>
#include <string>
//#include <data_var.hpp>
#include <functional>
#include "../device/dp_common.h"
using namespace std;
enum{
    EMSG_NULL=0,
    EMSG_SYS_BASE=0,
    EMSG_SYS_START,
    EMSG_SYS_STOP,
    EMSG_CHANNEL_BASE=0x08000000,
    EMSG_LOOP,
    EMSG_DP_UPDATE,
};


class CMsg{
public:
    CMsg();
    virtual ~CMsg();

public:
    int m_type;
    int m_srcId;
    int m_dstId;
    int m_msgId;
};

typedef shared_ptr<CMsg> CMsg_Ptr;



class msg_start:public CMsg{
public:
    msg_start(){
        m_type = EMSG_SYS_START;
    }
    virtual ~msg_start(){}
};

typedef shared_ptr<msg_start> msg_start_ptr;


using CMsgCb = std::function<void(CMsg_Ptr)>;


class msg_stop:public CMsg{
public:
    msg_stop(){
        m_type = EMSG_SYS_STOP;
    }
    virtual ~msg_stop(){}
};

typedef shared_ptr<msg_stop> msg_stop_ptr;


class msg_loop:public CMsg{
public:
    msg_loop(){
        m_type = EMSG_LOOP;
    }
    virtual ~msg_loop(){}
};

typedef shared_ptr<msg_loop> msg_loop_ptr;


class msg_update_value:public CMsg{
    public:
    msg_update_value(){
        m_type = EMSG_DP_UPDATE;
    }
    dp_param_t m_dpparam;

    virtual ~msg_update_value(){}
};
typedef shared_ptr<msg_update_value> msg_update_ptr;
#endif